<template>
	<view class="user-content" :style="{backgroundImage: `url(${bgUrl})`}">
		<text class="global-text-button text-button" @click="toSettings">设置</text>
		<view class="user-card flex-row-between" @click="toEdit">
			<view class="flex-row">
				<UserAvatar class="avatar" :name="userInfo.name" :src="userInfo.avatar" />
				<view>
					<view class="use-name">{{userInfo.name}}</view>
					<view v-if="!isHr" class="online-edit flex-row" @click.stop="toOnline">
						<text>个人简介</text>
						<uni-icons type="compose" size="36rpx" />
					</view>
				</view>
			</view>
			<uni-icons type="right" />
		</view>
	</view>
</template>

<script>
	import store from '@/store';
	export default {
		computed: {
			isHr() {
				const {
					user
				} = store.state;
				return user.type === '1';
			},
			userInfo() {
				const {
					user
				} = store.state;
				return user;
			}
		},
		data() {
			return {
				bgUrl: require("@/static/icons/profile/bg.png"),
			}
		},
		methods: {
			toSettings() {

			},
			toEdit() {
				uni.navigateTo({
					url: '/pages/tabBar/profile/edit'
				})
			},
			toOnline() {
				uni.navigateTo({
					url: '/pages/resume/online/index'
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.user-content {
		position: relative;
		height: 385rpx;
		background-size: 100% 100%;

		.text-button {
			position: absolute;
			bottom: 90px;
			right: 45rpx;
		}

		.user-card {
			position: absolute;
			bottom: 25px;
			left: 45rpx;
			right: 45rpx;

			.use-name {
				font-size: 45rpx;
				color: #333;
			}

			.online-edit {
				margin-top: 6px;
				font-size: 32rpx;
				color: #333;

				text {
					margin-right: 5px;
				}
			}

			.avatar {
				width: 115rpx;
				height: 115rpx;
				border-radius: 115rpx;
				margin-right: 20rpx;
			}
		}
	}
</style>